import React, { Component } from "react";
import Main from "./c-cpns/Main";
import Header from "./c-cpns/Header";
import Footer from "./c-cpns/Footer";
import AddCounter from "./c-cpns/AddCounter";

export default class App extends Component {
  constructor() {
    super()
    this.state = {
      count: 100
    }
  }
  changeCount(val) {
    this.setState({
      count: this.state.count + val
    })
  }
  render() {
    const { count } = this.state
    return(
    <div>
      <div>
        当前计数：{ count }
        <AddCounter addClick={(val) => this.changeCount(val)}></AddCounter>
      </div>
      <Header></Header>
      <Main></Main>
      <Footer></Footer>
    </div>
    )
  }
}
